package topcoder.srm588;

public class KeyDungeonDiv2 {

	public int countDoors(int[] doorR, int[] doorG, int[] keys)
	{
		int ans = 0;
		for(int i = 0; i < doorR.length; i++) {
			int whiteMatch = 0;
			if(doorR[i] >= keys[0])
				whiteMatch = doorR[i] - keys[0];
			if(doorG[i] >= keys[1])
				whiteMatch += (doorG[i] - keys[1]);
			if(whiteMatch <= keys[2])
				ans++;
		}
		return ans;
	}
	public static void main(String[] args) {
		KeyDungeonDiv2 kd = new KeyDungeonDiv2();
		int[] doorR = 	{41,44,41,57,58,74,84,100,58,2,43,32,82,97,44,13,35,98,96,81,43,77,18,51,27,
				 27,39,39,45,82,59,20,28,93,6,39,64,78,28,85,17,56,3,68,4,0,36,80,41,77};
		int[] doorG = {67,15,53,36,88,29,26,57,68,99,97,27,51,70,3,49,65,75,35,92,66,0,23,96,38,86,
				 98,31,26,75,30,2,92,78,100,99,38,26,85,74,77,15,16,48,100,88,55,93,99,54};
		int[] keys = {39,31,34};
		System.out.println(kd.countDoors(doorR, doorG, keys));

	}

}
